package com.learn.controller;

import com.learn.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class MovieController {

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("/movie/{id}")
    public User findById (@PathVariable Long id){
        User user = this.restTemplate.getForObject("http://localhost:7900/simple/"+id,User.class);
        return user;
    }
}
